struct _GtkRangePrivate
{
- GtkWidget *mouse_location;
/* last mouse coords we got, or G_MININT if mouse is outside the range */
gint mouse_x;
gint mouse_y;
GdkRectangle *slider_rect);
static gboolean gtk_range_scroll (GtkRange *range,
GtkScrollType scroll);
-static void gtk_range_update_mouse_location (GtkRange *range);
static void gtk_range_calc_slider (GtkRange *range);
static void gtk_range_calc_marks (GtkRange *range);
static void gtk_range_adjustment_value_changed (GtkAdjustment *adjustment,
priv->grab_location = NULL;
- gtk_range_update_mouse_location (range);
-
update_trough_state (range);
update_slider_state (range);
update_zoom_state (range, FALSE);
GtkRange *range)
{
GtkRangePrivate *priv = range->priv;
+ GtkWidget *mouse_location;
- gtk_range_update_mouse_location (range);
+ mouse_location = gtk_widget_pick (GTK_WIDGET (range), x, y);
- if (priv->mouse_location == priv->slider_widget && !priv->zoom)
+ if (mouse_location == priv->slider_widget && !priv->zoom)
{
GtkAllocation slider_alloc;
guint button;
GdkModifierType state_mask;
GtkAllocation slider_alloc;
+ GtkWidget *mouse_location;
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
priv->mouse_x = x;
priv->mouse_y = y;
- gtk_range_update_mouse_location (range);
gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc);
g_object_get (gtk_widget_get_settings (widget),
"gtk-primary-button-warps-slider", &primary_warps,
NULL);
+ mouse_location = gtk_widget_pick (widget, x, y);
- if (priv->mouse_location == priv->slider_widget &&
+ /* For the purposes of this function, we ignore fill and highlight and
+ * handle them like the trough */
+ if (mouse_location == priv->fill_widget ||
+ mouse_location == priv->highlight_widget)
+ mouse_location = priv->trough_widget;
+
+ if (mouse_location == priv->slider_widget &&
gdk_event_triggers_context_menu (event))
{
gboolean handled;
return;
}
- if (priv->mouse_location == priv->slider_widget)
+ if (mouse_location == priv->slider_widget)
{
/* Shift-click in the slider = fine adjustment */
if (shift_pressed)
update_initial_slider_position (range, x, y, &slider_alloc);
range_grab_add (range, priv->slider_widget);
}
- else if (priv->mouse_location == priv->trough_widget &&
+ else if (mouse_location == priv->trough_widget &&
(source == GDK_SOURCE_TOUCHSCREEN ||
(primary_warps && !shift_pressed && button == GDK_BUTTON_PRIMARY) ||
(!primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
update_slider_position (range, x, y);
}
- else if (priv->mouse_location == priv->trough_widget &&
+ else if (mouse_location == priv->trough_widget &&
((primary_warps && shift_pressed && button == GDK_BUTTON_PRIMARY) ||
(!primary_warps && !shift_pressed && button == GDK_BUTTON_PRIMARY) ||
(primary_warps && button == GDK_BUTTON_MIDDLE)))
scroll = range_get_scroll_for_grab (range);
gtk_range_add_step_timer (range, scroll);
}
- else if (priv->mouse_location == priv->trough_widget &&
+ else if (mouse_location == priv->trough_widget &&
button == GDK_BUTTON_SECONDARY)
{
/* autoscroll */
priv->mouse_y = y;
}
- gtk_range_update_mouse_location (range);
-
return GDK_EVENT_PROPAGATE;
}
gtk_widget_error_bell (GTK_WIDGET (range));
}
-/* Update mouse location, return TRUE if it changes */
-static void
-gtk_range_update_mouse_location (GtkRange *range)
-{
- GtkRangePrivate *priv = range->priv;
- gint x, y;
- GtkWidget *widget = GTK_WIDGET (range);
-
- x = priv->mouse_x;
- y = priv->mouse_y;
-
- if (priv->grab_location != NULL)
- priv->mouse_location = priv->grab_location;
- else
- priv->mouse_location = gtk_widget_pick (widget, x, y);
-
- /* That's what you get for not attaching gestures to the correct widget */
- while (priv->mouse_location &&
- priv->mouse_location != priv->slider_widget &&
- priv->mouse_location != priv->trough_widget &&
- priv->mouse_location != widget)
- priv->mouse_location = gtk_widget_get_parent (priv->mouse_location);
-}
-
static void
gtk_range_compute_slider_position (GtkRange *range,
gdouble adjustment_value,
gtk_widget_set_visible (priv->slider_widget, visible);
gtk_widget_queue_allocate (priv->trough_widget);
- gtk_range_update_mouse_location (range);
}
static void